package cn.liberals.basic.controller;

import cn.liberals.basic.exception.BusinessException;
import cn.liberals.basic.utils.AjaxResult;
import cn.liberals.basic.vo.LoginVo;
import cn.liberals.user.service.ILogininfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/logout")
public class logoutController {

    @Autowired
    private ILogininfoService logininfoService;

    public AjaxResult logout(){
        try {
            logininfoService.logout();
            return AjaxResult.me();
        } catch (BusinessException e) {
            e.printStackTrace();
            return AjaxResult.me().setSuccess(false).setMessage(e.getMessage());
        }catch (Exception e) {
            e.printStackTrace();
            return AjaxResult.me().setSuccess(false).setMessage("系统繁忙，请重试！");
        }
    }
}
